package com.pp.controller;


import com.pp.bean.GovAbotUs;
import com.pp.service.IGovAbotUsService;
import com.pp.util.Respons.ResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 关于我们 前端控制器
 * </p>
 *
 * @author 冯政尚
 * @since 2019-04-02
 */
@Controller
@RequestMapping("/govAbotUs")
@Api(value = "关于我们Controller", tags = {"关于我们类型类"})
public class GovAbotUsController {

    @Autowired
    IGovAbotUsService iGovAbotUsService;


    @RequestMapping(value = "/insert",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "新增关于我们")
    public Map insert(@RequestBody GovAbotUs govAbotUs){
        if(iGovAbotUsService.save(govAbotUs)){
            return ResponseUtil.getSuccessMap();
        }
        return ResponseUtil.getExceptionMap();
    }


    @RequestMapping(value = "updateById",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "修改关于我们")
    public Map updateById(@RequestBody GovAbotUs govAbotUs){
        if(iGovAbotUsService.updateById(govAbotUs)){
            return ResponseUtil.getSuccessMap();
        }
        return ResponseUtil.getExceptionMap();
    }


    @RequestMapping(value = "deleteById",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "删除关于我们")
    public Map deleteById(@RequestBody GovAbotUs govAbotUs){
        if(iGovAbotUsService.removeById(govAbotUs)){
            return ResponseUtil.getSuccessMap();
        }
        return ResponseUtil.getExceptionMap();

    }


    @RequestMapping(value = "select",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询关于我们")
    public List<GovAbotUs> select(){
        return iGovAbotUsService.list();
    }





}
